package com.ls.lserp.modules.order.service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.ls.lserp.modules.order.entity.*;
import com.ls.lserp.modules.produce.entity.ProduceParameter;
import com.ls.lserp.modules.sys.entity.Brand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ls.lserp.common.persistence.Page;
import com.ls.lserp.common.service.CrudService;
import com.ls.lserp.common.utils.ResourcesUtil;
import com.ls.lserp.modules.common.entity.UploadFile;
import com.ls.lserp.modules.order.dao.BigcargoStyleDao;

/**
 * @ClassName: CategoryService
 * @Description: 大货款式 一览 新建 删除 修改
 * 
 * @author 于辉
 * @date 2017年01月19日
 * 
 */

@Service
@Transactional(readOnly = false)
public class BigcargoStyleService extends CrudService<BigcargoStyleDao, BigcargoStyle> {
	@Autowired
	// 分类方法接口
	private BigcargoStyleDao bigcargoStyleDao;

	/**
	 * @Title: findList
	 * @Description: 一览查询
	 * @param page
	 * @param bigcargoStyle
	 * @return Page<BigcargoStyle>
	 */
	public Page<BigcargoStyle> findList(Page<BigcargoStyle> page, BigcargoStyle bigcargoStyle) {
		// 设置分页参数
		bigcargoStyle.setPage(page);
		// 执行分页查询
		page.setList(bigcargoStyleDao.findList(bigcargoStyle));
		return page;
	}

	/**
	 * @Title: findCustomerList
	 * @Description: 客户
	 * @param bigcargoStyle
	 * @return bigcargoStyle
	 */
	public BigcargoStyle findCustomerList(BigcargoStyle bigcargoStyle) {
		// 客户列表检索
		bigcargoStyle.setSelOgnlist(bigcargoStyleDao.findCustomerList(bigcargoStyle));
		return bigcargoStyle;
	}

	/**
	 * 子页面 top1 的子页面内容
	 */

	public List<BigcargoStyle> getNextChildPage(BigcargoStyle bigcargoStyle) {
		List<BigcargoStyle> list = null;
		try {
			list = bigcargoStyleDao.getNextChildPage(bigcargoStyle);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

	/**
	 * 子页面 top1 的子页面内容
	 */

	public List<BigcargoStyleFitProperty> findBigcargoStyleFitProperty(BigcargoStyle bigcargoStyle) {
		List<BigcargoStyleFitProperty> list = null;
		try {
			list = bigcargoStyleDao.findBigcargoStyleFitProperty(bigcargoStyle);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

	/**
	 * 获取图片关联ID
	 * 
	 * @param bigcargoStyle
	 * @return
	 */
	public String getstyleOptionId(BigcargoStyle bigcargoStyle) {
		String id = "";
		id = bigcargoStyleDao.getstyleOptionId(bigcargoStyle);
		return id;
	}

	/**
	 * 获取所有图片信息
	 * 
	 * @param id
	 * @return
	 */
	public List<UploadFile> getAllFile(String id) {
		List<UploadFile> list = bigcargoStyleDao.getAllFile(id);
		return list;
	}

	/**
	 * 追加款式信息
	 * 
	 * @param bigcargoStyle
	 */
	public void insertStyleContract(BigcargoStyle bigcargoStyle) throws SQLException {
		StyleFeedBack sfb = bigcargoStyle.getStyleFeedBack();
		// 追加款式信息
		bigcargoStyleDao.insert(bigcargoStyle);
       // 追加成衣入库信息
		bigcargoStyle.preInsert();
		bigcargoStyleDao.insertInventoryClothes(bigcargoStyle);
		UploadFileData upFile = bigcargoStyle.getUploadFileData();
		// 数据插入
		if (upFile != null) {
			insetFile(upFile, bigcargoStyle, upFile.getImageList());
			insetFile(upFile, bigcargoStyle, upFile.getUploadDataList());
		}
		bigcargoStyleDao.insertStyleFit(bigcargoStyle);
		// 意见反馈与文件表关联插入
		saveFeedBackandFile(bigcargoStyle);

		if (bigcargoStyle.getChangeMaterial() != null) {
			bigcargoStyleDao.insertStyleMaterial(bigcargoStyle);
		}
		// 追加顾客表关联信息
		bigcargoStyleDao.insertStylecustomer(bigcargoStyle);
		if (bigcargoStyle.getProductionEntity()!=null) {
			bigcargoStyleDao.insertStyleProction(bigcargoStyle);
		}

	}

	/**
	 * 追加样品需求信息
	 * 
	 * @param bigcargoStyle
	 */
	public void insertStyleSampleDemand(BigcargoStyle bigcargoStyle) throws SQLException {
		UploadFileData upFile = bigcargoStyle.getUploadFileData();
		bigcargoStyle.setSampleRequestStatus(ResourcesUtil.getConfig("specimen_demand_status_create"));
		bigcargoStyleDao.insertSample(bigcargoStyle);
		bigcargoStyleDao.insertSampleStyle(bigcargoStyle);
		bigcargoStyleDao.insertSampleSizeQuantity(bigcargoStyle);
		if (bigcargoStyle.getProduceParameter()!=null) {
			bigcargoStyleDao.insertStyleOperating(bigcargoStyle);
		}
		if (bigcargoStyle.getProductionEntity()!=null) {
			bigcargoStyleDao.insertStyleProction(bigcargoStyle);
		}
		// 数据插入
		if (upFile != null) {
			insetFile(upFile, bigcargoStyle, upFile.getImageList());
			insetFile(upFile, bigcargoStyle, upFile.getUploadDataList());
		}
		bigcargoStyleDao.insertStyleFit(bigcargoStyle);
		saveFeedBackandFile(bigcargoStyle);
		if (bigcargoStyle.getChangeMaterial() != null) {
			bigcargoStyleDao.insertStyleMaterialSpecimen(bigcargoStyle);
			insertUnitCost(bigcargoStyle,true);
		}
	}

	/**
	 * 更新样品需求信息
	 * 
	 * @param bigcargoStyle
	 */
	public void updateStyleSampleDemand(BigcargoStyle bigcargoStyle) throws SQLException {
		UploadFileData upFile = bigcargoStyle.getUploadFileData();
		bigcargoStyleDao.deleteUploadFileSpecimen(bigcargoStyle);
		bigcargoStyleDao.deleteStleFileSpecimen(bigcargoStyle);
		bigcargoStyleDao.deleteStyleProduction(bigcargoStyle);
		bigcargoStyleDao.deleteStyleOperating(bigcargoStyle);
		bigcargoStyleDao.deleteStyleFeedBack(bigcargoStyle);
		bigcargoStyleDao.deleteStyleFit(bigcargoStyle);
		bigcargoStyleDao.deleteStyleMaterial(bigcargoStyle);
		//bigcargoStyleDao.deleteSampleStyle(bigcargoStyle);
		//bigcargoStyleDao.delSampleSizeQuantity(bigcargoStyle);
		insertUnitCost(bigcargoStyle,false);
		bigcargoStyleDao.upSampleSpecimen(bigcargoStyle);
		//bigcargoStyleDao.insertSampleStyle(bigcargoStyle);
		//bigcargoStyleDao.insertSampleSizeQuantity(bigcargoStyle);
		if (bigcargoStyle.getProduceParameter()!=null) {
			bigcargoStyleDao.insertStyleOperating(bigcargoStyle);
		}
		if (bigcargoStyle.getProductionEntity()!=null) {
			bigcargoStyleDao.insertStyleProction(bigcargoStyle);
		}
		// 数据插入
		if (upFile != null) {
			insetFile(upFile, bigcargoStyle, upFile.getImageList());
			insetFile(upFile, bigcargoStyle, upFile.getUploadDataList());
		}
		bigcargoStyleDao.insertStyleFit(bigcargoStyle);
		saveFeedBackandFile(bigcargoStyle);
		if (bigcargoStyle.getChangeMaterial() != null) {
			bigcargoStyleDao.insertStyleMaterialSpecimen(bigcargoStyle);
			insertUnitCost(bigcargoStyle,true);
		}
		
	}

	/**
	 * 追加upload文件
	 * 
	 * @param upFile
	 * @param bigcargoStyle
	 * @param allDbList
	 * 
	 */
	public void insetFile(UploadFileData upFile, BigcargoStyle bigcargoStyle, List<UploadFileData> allDbList) {
		if (allDbList != null) {
			for (int i = 0; i < allDbList.size(); i++) {
				if (!"".equals(allDbList.get(i).getFilePath()) && allDbList.get(i).getFilePath() != null) {
					// 文件路径
					upFile.setFileKbn(allDbList.get(i).getFileKbn());
					// 文件路径
					upFile.setFilePath(allDbList.get(i).getFilePath());
					// 备注
					upFile.setFileRemarks(allDbList.get(i).getFileRemarks());
					// 文件名
					upFile.setUploadFileName(allDbList.get(i).getUploadFileName());
					// 所在模块区分
					upFile.setModuleKbn(allDbList.get(i).getModuleKbn());
					// 所在模块区分
					upFile.setServiceKbn(allDbList.get(i).getServiceKbn());
					// FTP文件名称
					upFile.setFtpFile(allDbList.get(i).getFtpFile());
					// 创建人
					upFile.setCreateUser(allDbList.get(i).getCreateUser());
					// 创建日期
					upFile.setCreateTime(allDbList.get(i).getCreateTime());
					// 上传文件管理表出入数据
					bigcargoStyleDao.insertUploadFile(upFile);
					// 取得當前一條數據的自增主鍵
					bigcargoStyle.setFileID(upFile.getFileId());
					// 根据上传文件管理表中的文件ID插入款式_上传文件关联表中
					bigcargoStyleDao.insertStyleFile(bigcargoStyle);
				}
			}
		}
	}

	/**
	 * 款式单耗插入删除数据
	 */
	public void insertUnitCost(BigcargoStyle bigcargoStyle,boolean flg) {
		if ("1".equals(bigcargoStyle.getSampleTypeChecked())) {
			
			if (flg) {
				int materialLength = bigcargoStyle.getChangeMaterial().getCgMatList().size();
				ChangeMaterial changeMaterial = null;
				List<ChangeMaterial> materialList = bigcargoStyle.getChangeMaterial().getCgMatList();
				BigcargoStyle bigcargoTemp = bigcargoStyleDao.selectUnitCost(bigcargoStyle);
				int uniCost = bigcargoTemp.getUnitCostIdCount();
				String countTemp = "";
				if (uniCost<9) {
					countTemp = "0"+uniCost;
				} else {
					countTemp = ""+uniCost;
				}
				bigcargoStyle.setUnitCostNo("20"+countTemp+bigcargoStyle.getStyleNo());
				bigcargoStyle.preInsert();
				bigcargoStyleDao.insertUnitCost(bigcargoStyle);
				bigcargoStyleDao.insertUnitCostType(bigcargoStyle);
				for (int i = 0; i < materialLength; i++) {
					changeMaterial = new ChangeMaterial();
					changeMaterial.setUnitCostId(bigcargoStyle.getUnitCostId());
					changeMaterial.setSampleRequestId(bigcargoStyle.getSampleRequestId());
					changeMaterial.setStyleId(bigcargoStyle.getStyleID());
					changeMaterial.setCgMaterialStageCd("AUDIT_PHASE_CD-PHASE_CD_30");
					changeMaterial.setMaterialUnitPrice(materialList.get(i).getMaterialUnitPrice());
					changeMaterial.setMaterialLoss(materialList.get(i).getMaterialLoss());
					changeMaterial.setCgMaterialRemarks(materialList.get(i).getCgMaterialRemarks());
					changeMaterial.setCgMaterialPlacement(materialList.get(i).getCgMaterialPlacement());
					changeMaterial.setCgMaterialId(materialList.get(i).getCgMaterialId());
					changeMaterial.setCreateDate(bigcargoStyle.getCreateDate());
					changeMaterial.setCreateUser(bigcargoStyle.getCreateUser());
					bigcargoStyleDao.insertMaterialSpecimenUnitCost(changeMaterial);
				}
			} else {
				bigcargoStyleDao.deleteUnitCost(bigcargoStyle);
				bigcargoStyleDao.deleteMaterialSpecimenUnitCost(bigcargoStyle);
				bigcargoStyleDao.deleteUnitCostType(bigcargoStyle);
			}

		}
	}

	/**
	 * 参考 查看-- 款式Tab页用
	 */
	public BigcargoStyle styleMassageTab(BigcargoStyle bigcargoStyle) {
		// 样品尺码组
		SampleType st = new SampleType();
		// 量体实体类
		StyleFit styleObj = new StyleFit();
		// 大货实体类
		BigcargoStyle bs = new BigcargoStyle();
		List<SampleType> sampleTypeList = null;
		List<StyleFit> styleFitList = null;
		List<BigcargoStyleFitProperty> bigStyleFitlist = null;
		// 款式图片实体类
		BigcargoStyleFitProperty bigSfp = new BigcargoStyleFitProperty();
		// 尺码list
		try {
			// 尺码list
			if (bigcargoStyle.getSampleRequestId() > 0) {
				sampleTypeList = bigcargoStyleDao.selectSampleType(bigcargoStyle);
			} else {
				sampleTypeList = bigcargoStyleDao.selectSampleTypeTemp(bigcargoStyle);
			}
			// 量体信息查询
			styleFitList = bigcargoStyleDao.selectStyleFit(bigcargoStyle);
			// 款式图片信息查询
			bigStyleFitlist = bigcargoStyleDao.findBigcargoStyleFitProperty(bigcargoStyle);
		} catch (Exception e) {
			e.printStackTrace();
		}
		bigSfp.setBigcargoStyleFitProperty(bigStyleFitlist);
		styleObj.setStyleFitList(styleFitList);
		st.setStyleFit(styleObj);
		st.setSampleTypeList(sampleTypeList);
		bs.setBigcargoStyleFitProperty(bigSfp);
		bs.setSampleTypeDataList(st);
		return bs;
	}
	/**
	 * 参考 查看-- 面料Tab页用
	 */
	public BigcargoStyle materialTab(BigcargoStyle bigcargoStyle) {
		// 大货实体类
		BigcargoStyle bs = new BigcargoStyle();
		List<ChangeMaterial> materialList = null;
		// 面辅料实体类
		ChangeMaterial cm = new ChangeMaterial();
		try {
			// 面辅料信息查询
			materialList = bigcargoStyleDao.selectMaterial(bigcargoStyle);
		} catch (Exception e) {
			e.printStackTrace();
		}
		cm.setCgMatList(materialList);
		bs.setChangeMaterial(cm);
		return bs;
	}
	/**
	 * 参考 查看-- 意见要求Tab页用
	 */
	public BigcargoStyle feedBackTab(BigcargoStyle bigcargoStyle) {
		// 大货实体类
		BigcargoStyle bs = new BigcargoStyle();
		// 意见要求实体类
		StyleFeedBack sfb = new StyleFeedBack();
		List<StyleFeedBack> feedbackList = null;
		try {
			// 意见要求信息查询
			feedbackList = bigcargoStyleDao.selectfeedback(bigcargoStyle);
		} catch (Exception e) {
			e.printStackTrace();
		}
		sfb.setStyleFeedBackList(feedbackList);
		bs.setStyleFeedBack(sfb);
		return bs;
	}

	/**
	 * 参考 查看-- 样板文件Tab页用
	 */
	public BigcargoStyle selectAllUploudFile(BigcargoStyle bigcargoStyle) {
		// 大货实体类
		BigcargoStyle bs = new BigcargoStyle();
		List<UploadFileData> imageListTemp = null;
		// 上传文件实体类
		UploadFileData uf = new UploadFileData();
		// 上传文件查询
		imageListTemp = bigcargoStyleDao.imageList(bigcargoStyle);
		uf.setAllDataList(imageListTemp);
		bs.setUploadFileData(uf);
		return bs;
	}

	/**
	 * 画面更新
	 */
	public void updateStyle(BigcargoStyle bigcargoStyle) {
		bigcargoStyleDao.upStyleContract(bigcargoStyle);
		bigcargoStyleDao.deleteStyleCustomer(bigcargoStyle);
		bigcargoStyleDao.deleteUploadFile(bigcargoStyle);
		bigcargoStyleDao.deleteStyleProduction(bigcargoStyle);
		bigcargoStyleDao.deleteStyleFile(bigcargoStyle);
		bigcargoStyleDao.deleteStyleFeedBack(bigcargoStyle);
		bigcargoStyleDao.deleteStyleFit(bigcargoStyle);
		bigcargoStyleDao.deleteStyleMaterial(bigcargoStyle);
		bigcargoStyleDao.delFeedFile(bigcargoStyle);
		UploadFileData upFile = bigcargoStyle.getUploadFileData();

		// 数据插入
		if (upFile != null) {
			insetFile(upFile, bigcargoStyle, upFile.getImageList());
			insetFile(upFile, bigcargoStyle, upFile.getUploadStyleList());
			insetFile(upFile, bigcargoStyle, upFile.getUploadDataList());
		}
		bigcargoStyleDao.insertStyleFit(bigcargoStyle);
		saveFeedBackandFile(bigcargoStyle);

		if (bigcargoStyle.getChangeMaterial() != null) {
			bigcargoStyleDao.insertStyleMaterial(bigcargoStyle);
		}
		// 追加顾客表关联信息
		bigcargoStyleDao.insertStylecustomer(bigcargoStyle);
		if (bigcargoStyle.getProductionEntity()!=null) {
			bigcargoStyleDao.insertStyleProction(bigcargoStyle);
		}
	}
	// 意见反馈新建
	public void saveFeedBackandFile (BigcargoStyle bigcargoStyle) {
		StyleFeedBack sfb = bigcargoStyle.getStyleFeedBack();
		UploadFileData upFileTemp;
		if (sfb != null) {
			int sfbLength = sfb.getStyleFeedBackList().size();
			for (int i = 0; i < sfbLength; i++) {
				sfb.getStyleFeedBackList().get(i).setStyleID(bigcargoStyle.getStyleID());
				bigcargoStyleDao.insertStyleFeedBack(sfb.getStyleFeedBackList().get(i));
				UploadFileData upFileinsertTemp = sfb.getStyleFeedBackList().get(i).getUploadFileData();
				for (int j = 0; j < upFileinsertTemp.getUploadStyleList().size(); j++) {
					upFileinsertTemp = sfb.getStyleFeedBackList().get(i).getUploadFileData();
					upFileTemp = new UploadFileData();
					// 文件路径
					upFileTemp.setFileKbn(upFileinsertTemp.getUploadStyleList().get(j).getFileKbn());
					// 文件路径
					upFileTemp.setFilePath(upFileinsertTemp.getUploadStyleList().get(j).getFilePath());
					// 备注
					upFileTemp.setFileRemarks(upFileinsertTemp.getUploadStyleList().get(j).getFileRemarks());
					// 文件名
					upFileTemp.setUploadFileName(upFileinsertTemp.getUploadStyleList().get(j).getUploadFileName());
					// 所在模块区分
					upFileTemp.setModuleKbn(upFileinsertTemp.getUploadStyleList().get(j).getModuleKbn());
					// 所在模块区分
					upFileTemp.setServiceKbn(upFileinsertTemp.getUploadStyleList().get(j).getServiceKbn());
					// FTP文件名称
					upFileTemp.setFtpFile(upFileinsertTemp.getUploadStyleList().get(j).getFtpFile());
					// 创建人
					upFileTemp.setCreateUser(upFileinsertTemp.getUploadStyleList().get(j).getCreateUser());
					// 创建日期
					upFileTemp.setCreateTime(upFileinsertTemp.getUploadStyleList().get(j).getCreateTime());
					// 上传文件管理表出入数据
					bigcargoStyleDao.insertUploadFile(upFileTemp);
					bigcargoStyle.setFeedBackId(sfb.getStyleFeedBackList().get(i).getFeedBackId());
					bigcargoStyle.setFileID(upFileTemp.getFileId());
					// 取得當前一條數據的自增主鍵
					bigcargoStyleDao.insertFeedFile(bigcargoStyle);
				}
			}
		}
	}
	public BigcargoStyle selectSpecimenDemandStyle(BigcargoStyle bigcargoStyle) {
		bigcargoStyle = bigcargoStyleDao.selectSpecmenDemandStyle(bigcargoStyle);
		return bigcargoStyle;
	}

	//
	public int countRequestId(BigcargoStyle bigcargoStyle) {
		int count = 0;
		SampleType st = bigcargoStyleDao.countRequestId(bigcargoStyle);
		count = st.getRequestCount();
		return count;
	}
	/**
	 * 供应厂与品牌连动查询
	 *
	 */
	public List<Brand> selectBrandCnList(BigcargoStyle bigcargoStyle) {
		List<Brand> brandList = new ArrayList<>();
		// 查询供应厂对应的品牌个数
		bigcargoStyle = bigcargoStyleDao.selectBrankId(bigcargoStyle);
		if (bigcargoStyle !=null ) {
			String brandVar = bigcargoStyle.getBrandIdStr();
			ArrayList alBrandTemp = new ArrayList();
			if (brandVar != null) {
				String [] barndTemp = brandVar.split(",");
				for (int i = 0; i < barndTemp.length; i++){
					alBrandTemp.add(barndTemp[i]);
				}
			}
			bigcargoStyle.setBrandList(alBrandTemp);
			// 查询对应的品牌中文
			brandList = bigcargoStyleDao.selectBrankNameCn(bigcargoStyle);
		}
		return brandList;
	}
	/**
	 * 参考 查看检索
	 */
	public BigcargoStyle styleSizeList(BigcargoStyle bigcargoStyle) {
		// 样品尺码组
		SampleType st = new SampleType();
		// 上传文件实体类
		UploadFileData uf = new UploadFileData();
		// 量体实体类
		StyleFit styleObj = new StyleFit();
		// 大货实体类
		BigcargoStyle bs = new BigcargoStyle();
		// 款式图片实体类
		BigcargoStyleFitProperty bigSfp = new BigcargoStyleFitProperty();
		// 面辅料实体类
		ChangeMaterial cm = new ChangeMaterial();
		// 意见要求实体类
		StyleFeedBack sfb = new StyleFeedBack();
		// 制作工艺实体类
		ProductionEntity productionEntity = new ProductionEntity();
		// 制作工序实体类
		ProduceParameter produceParameter = new ProduceParameter();
		List<ProductionEntity> productionEntityList = null;
		List<ProduceParameter> produceParameterList = null;
		List<UploadFileData> imageListTemp = null;
		List<StyleFit> styleFitList = null;
		List<BigcargoStyleFitProperty> bigStyleFitlist = null;
		List<ChangeMaterial> materialList = null;
		List<StyleFeedBack> feedbackList = null;
		List<SampleType> sampleTypeList = null;
		try {
			// 上传文件查询
			imageListTemp = bigcargoStyleDao.imageList(bigcargoStyle);
			// 量体信息查询
			styleFitList = bigcargoStyleDao.selectStyleFit(bigcargoStyle);
			// 款式图片信息查询
			bigStyleFitlist = bigcargoStyleDao.findBigcargoStyleFitProperty(bigcargoStyle);
			// 面辅料信息查询
			materialList = bigcargoStyleDao.selectMaterial(bigcargoStyle);
			// 意见要求信息查询
			feedbackList = bigcargoStyleDao.selectfeedback(bigcargoStyle);
			int feedLen = feedbackList.size();
			for (int i= 0; i < feedLen; i++) {
				List<UploadFileData> upf = bigcargoStyleDao.feedFileList(feedbackList.get(i).getFeedBackId());
				UploadFileData updataP = new UploadFileData();
				updataP.setUploadDataList(upf);
				feedbackList.get(i).setUploadFileData(updataP);
			}
			// 尺码list
			if (bigcargoStyle.getSampleRequestId() > 0) {
				sampleTypeList = bigcargoStyleDao.selectSampleType(bigcargoStyle);
			} else {
				sampleTypeList = bigcargoStyleDao.selectSampleTypeTemp(bigcargoStyle);
			}
			productionEntityList = bigcargoStyleDao.seleProduction(bigcargoStyle);
			produceParameterList = bigcargoStyleDao.selOperatingList(bigcargoStyle);
		} catch (Exception e) {
			e.printStackTrace();
		}
		productionEntity.setProductionList(productionEntityList);
		produceParameter.setProduceParameterList(produceParameterList);
		uf.setAllDataList(imageListTemp);
		styleObj.setStyleFitList(styleFitList);
		st.setStyleFit(styleObj);
		st.setSampleTypeList(sampleTypeList);
		bigSfp.setBigcargoStyleFitProperty(bigStyleFitlist);
		bs.setBigcargoStyleFitProperty(bigSfp);
		bs.setSampleTypeDataList(st);
		cm.setCgMatList(materialList);
		sfb.setStyleFeedBackList(feedbackList);
		bs.setStyleFeedBack(sfb);
		bs.setChangeMaterial(cm);
		bs.setUploadFileData(uf);
		bs.setProductionEntity(productionEntity);
		bs.setProduceParameter(produceParameter);
		return bs;
	}
	/**
	 * 参考 查看检索
	 */
	public BigcargoStyle styleSizeFitList(BigcargoStyle bigcargoStyle) {
		// 样品尺码组
		SampleType st = new SampleType();
		// 量体实体类
		StyleFit styleObj = new StyleFit();
		// 款式图片实体类
		BigcargoStyleFitProperty bigSfp = new BigcargoStyleFitProperty();
		// 大货实体类
		BigcargoStyle bs = new BigcargoStyle();
		//生产工艺实体类
		ProduceParameter pP = new ProduceParameter();
		// 制作工艺实体类
		List<StyleFit> styleFitList = null;
		List<ProduceParameter> operatingList = null;
		List<BigcargoStyleFitProperty> bigStyleFitlist = null;
		List<SampleType> sampleTypeList = null;
		try {
			// 量体信息查询
			styleFitList = bigcargoStyleDao.selectStyleFit(bigcargoStyle);
			// 款式图片信息查询
			bigStyleFitlist = bigcargoStyleDao.findBigcargoStyleFitProperty(bigcargoStyle);
			
			operatingList = bigcargoStyleDao.srchOperatingList(bigcargoStyle);
			// 尺码list
			if (bigcargoStyle.getSampleRequestId() > 0) {
				sampleTypeList = bigcargoStyleDao.selectSampleType(bigcargoStyle);
			} else {
				sampleTypeList = bigcargoStyleDao.selectSampleTypeTemp(bigcargoStyle);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		styleObj.setStyleFitList(styleFitList);
		st.setStyleFit(styleObj);
		bigSfp.setBigcargoStyleFitProperty(bigStyleFitlist);
		bs.setBigcargoStyleFitProperty(bigSfp);
		pP.setProduceParameterList(operatingList);
		st.setSampleTypeList(sampleTypeList);
		bs.setSampleTypeDataList(st);
		bs.setProduceParameter(pP);
		return bs;
	}

	public List<ProductionEntity> selProductinoList(ProductionEntity productionEntity) {
		List<ProductionEntity> proList = bigcargoStyleDao.selProductinoList(productionEntity);
		return proList;
	}
}
